const searchModel = require('../models/searchModel')

const searchUsername = (req, res) => {
    const str = req.query.searchThing
    if (str === '' || str === undefined) {
        return res.status(200).send('').end()
    }

    searchModel.searchUsername(str+'%').then(rs => {
        return res.status(200).send(rs).end()
    }).catch(err => {
        return res.status(500).send(err).end()
    })
}

module.exports = {
    searchUsername
}